package collection.homework.Demo1;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        Student s1 = new Student(1,"小亮",99);
        Student s2 = new Student(2,"小强",56);
        Student s3 = new Student(3,"小响",90);
        Student s4 = new Student(4,"小勇",75);
        ArrayList<Student> students = new ArrayList<Student>();
        students.add(s1);
        students.add(s2);
        students.add(s3);
        students.add(s4);
        System.out.println("考生信息如下：");
        students.forEach(System.out::println);
        System.out.println("成绩最低的是：");
        students.remove(minScore(students));
        System.out.println("录取的学生有：");
        for (Student student : students) {
            System.out.println(student);
        }
    }
    public static Student minScore(ArrayList<Student> students){
        Student minScore = students.getFirst();
        for(Student student : students){
            if(student.getScore() < minScore.getScore()){
                minScore = student;
            }
        }
        System.out.println(minScore);
        return minScore;
    }
}
